import 'package:flutter/material.dart';
import 'package:flutter_framework/widgets/multiple_scroll_box.dart';

class TestMultilScroll extends StatefulWidget {
  const TestMultilScroll({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<TestMultilScroll> createState() => _TestMultilScrollState();
}

class _TestMultilScrollState extends State<TestMultilScroll> {
  final ScrollController _pageController = ScrollController();


  @override
  void dispose() {
    // TODO: implement dispose
    _pageController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: MultipleScrollBox(
        scrollCtrl: _pageController,
        child: ListView(
          controller: _pageController,
          children: [
            Container(
              height: 200,
              color: Colors.green,
            ),
            Container(
              height: 200,
              color: Colors.red,
            ),
            // Padding(
            //   padding: const EdgeInsets.only(bottom: 8.0),
            //   child: ConstrainedBox(
            //     constraints: const BoxConstraints(maxHeight: 200),
            //     child: SingleChildScrollView(
            //       padding: const EdgeInsets.only(right: 15),
            //       // controller: _textAController,
            //       physics: const ClampingScrollPhysics(),
            //       child: Column(
            //         children: [
            //           const Text(
            //             'Scrollable Child 1',
            //             softWrap: true,
            //             textAlign: TextAlign.center,
            //           ),
            //           Container(
            //             color: Colors.amber,
            //             height: 600,
            //           )
            //         ],
            //       ),
            //     ),
            //   ),
            // ),
            Container(
              height: 10,
              color: Colors.purple,
            ),
            Padding(
              padding: const EdgeInsets.only(top: 8.0),
              child: ConstrainedBox(
                constraints: const BoxConstraints(maxHeight: 200),
                child: SingleChildScrollView(
                  // controller: _textBController,
                  physics: const ClampingScrollPhysics(),
                  padding: const EdgeInsets.only(right: 15),
                  child: Column(
                    children: [
                      const Text(
                        'Scrollable Child 2',
                        softWrap: true,
                        textAlign: TextAlign.center,
                      ),
                      ListView.separated(
                        physics: const NeverScrollableScrollPhysics(),
                        separatorBuilder: (BuildContext context, index) {
                          return Container(
                            height: 12,
                            width: 50,
                            color: Colors.grey,
                          );
                        },
                        shrinkWrap: true,
                        padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
                        itemCount: 5,
                        itemBuilder: (BuildContext context, int index) {
                          return Container(
                            height: 60,
                            color: Colors.black,
                          );
                        },
                      ),
                    ],
                  ),
                ),
              ),
            ),
            Container(
              height: 100,
              color: Colors.blue,
            ),
          ],
        ),
      ),
    );
  }
}
